/**
 * @description menu config
 * @author Ling
 * @date 2024-08-08
 */

export function genConvertToLinkCardConfig() {
  return {
    /**
     * 异步获取 link-card 信息
     * @param linkText link text
     * @param linkUrl link url
     * @returns link-card info
     */
    async getLinkCardInfo(
      linkText: string,
      linkUrl: string,
      target: string,
      iconImgSrc?: string,
    ): Promise<{ title: string; iconImgSrc: string; target: string; url: string }> {
      // 该函数，用户自定义配置
      console.log('卡片的信息：', linkText, linkUrl, target);

      return new Promise((resolve) => {
        setTimeout(() => {
          const info = { title: linkText, iconImgSrc, target, url: linkUrl };
          console.log('卡片转后的信息：', info);
          resolve(info);
        }, 100);
      });
    },
  };
}
